<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>2-axios的GET和DELETE请求传参</title>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
    <script src="https://unpkg.com/axios/dist/axios.min.js"></script>

    <style></style>
  </head>
  <body>
    <div id="app"></div>
    <script>
      // get请求，直接在请求地址后面，携带上id
      axios.get('http://www.localhost:3000/axios/123').then(function (res) {
        console.log(res); //Object { data: "axios get", status: 200, statusText: "OK", headers: {…}, config: {…},
      });
      // delete需要在参数2params中携带请求参数
      axios
        .delete('http://www.localhost:3000/axios', {
          params: {
            id: 666,
          },
        })
        .then(function (res) {
          console.log(res); //Object { data: "axios -  delete: 666", status: 200, statusText: "OK", headers: {…},
        });
    </script>
  </body>
</html>
